package com.webSite.demo.cy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.webSite.demo.cy.bean.HomeMeta;

@Mapper
public interface HomeMetaMapper {

	@Select(value="select * from home_meta where state=1")
	List<HomeMeta> findAllInfo();
	
	@Select(value="select * from home_meta where currentMenu=#{0} and state=1")
	List<HomeMeta> findMeta(String currentMenu);
	
	@Insert(value="insert into home_meta(meta,currentMenu,state,created,updated) "
			+ "value(#{meta},#{currentMenu},#{state},#{created},#{updated})")
	int insertHomeMeta(HomeMeta homeMeta);
	
	@Update(value="update home_meta set meta=#{meta},currentMenu=#{currentMenu},"
			+ "state=#{state},created=#{created},updated=#{updated} where id=#{id}")
	int updateHomeMeta(HomeMeta homeMeta);
	
	@Update(value="update home_meta set state=0 where id=#{0}")
	int updateState(int id);
}
